package com.softline.documentsmall.controller;

import com.softline.documentsmall.ret.ReturnVO;
import com.softline.documentsmall.service.ZsIndexDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: documentsmall
 * @description:
 * @author: zwc
 * @create: 2021-03-16
 */

@Api(value="指数展示控制器",tags={"指数展示控制器"})
@RestController
@RequestMapping("/zsIndexDetail")
@CrossOrigin(allowCredentials = "true",allowedHeaders = "*")
public class ZsIndexDetailController {

    @Autowired
    ZsIndexDetailService zsIndexDetailService;

    @ApiOperation(value="指数排名--具体小指数展示需要的数据", notes = "指数排名--具体小指数展示需要的数据")
    @GetMapping(value = "/list")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型，1:全球数字竞争力指数，2.大数据发展指数,3.大数据法治指数,4.大数据安全指数,5.大数据金融风险防控指数,6.治理科技指数"),
            @ApiImplicitParam(name = "year", value = "年份，yyyy"),
            @ApiImplicitParam(name = "areaType", value = "地区类型，1.国家 2省域3.城市"),
            @ApiImplicitParam(name = "languageType", value = "语言类型 en:英文，cn中文，默认中文")

    })
    public ReturnVO list(@RequestParam("type") String type,@RequestParam("year") String year,@RequestParam(value = "areaType",required = false) String areaType,@RequestParam(value = "languageType",defaultValue = "cn")String languageType){
        return zsIndexDetailService.list(type,year,areaType,languageType);
    }

    @ApiOperation(value="大数据发展指数城市列表数据", notes = "大数据发展指数城市列表数据")
    @GetMapping(value = "/cityList")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型，1:全球数字竞争力指数，2.大数据发展指数,3.大数据法治指数,4.大数据安全指数,5.大数据金融风险防控指数,6.治理科技指数"),
            @ApiImplicitParam(name = "areaType", value = "地区类型，1.国家 2省域3.城市"),
            @ApiImplicitParam(name = "languageType", value = "语言类型 en:英文，cn中文，默认中文"),
            @ApiImplicitParam(name = "year", value = "年份，yyyy")
    })
    public ReturnVO bigDataDevIndexCityList(@RequestParam(value = "year",defaultValue ="2020") String year,@RequestParam(value = "areaType",required = false) String areaType,@RequestParam("type") String type,@RequestParam(value = "languageType",defaultValue = "cn")String languageType){

        return zsIndexDetailService.cityList(year,areaType,type,languageType);
    }


    @ApiOperation(value="大数据发展指数--根据城市获取数据", notes = "大数据发展指数城市列表数据--根据城市获取数据")
    @GetMapping(value = "/bigDataDevIndexDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型，1:全球数字竞争力指数，2.大数据发展指数,3.大数据法治指数,4.大数据安全指数,5.大数据金融风险防控指数,6.治理科技指数"),
            @ApiImplicitParam(name = "year", value = "年份，yyyy"),
            @ApiImplicitParam(name = "name", value = "地区名称，中文"),
            @ApiImplicitParam(name = "areaType", value = "地区类型，1.国家 2省域3.城市"),
            @ApiImplicitParam(name = "languageType", value = "语言类型 en:英文，cn中文，默认中文")
    })
    public ReturnVO bigDataDevIndexGetIndexDetail(@RequestParam("type")String type,@RequestParam("name")String name,@RequestParam("year")String year,@RequestParam(value = "areaType",required = false)String areaType,@RequestParam(value = "languageType",defaultValue = "cn")String languageType){

        return zsIndexDetailService.bigDataDevIndexGetIndexDetail(name,year,areaType,type,languageType);
    }

    @ApiOperation(value="城市详情页--国内城市", notes = "城市详情页--国内城市")
    @GetMapping(value = "/cityDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型，1:全球数字竞争力指数，2.大数据发展指数,3.大数据法治指数,4.大数据安全指数,5.大数据金融风险防控指数,6.治理科技指数"),
            @ApiImplicitParam(name = "year", value = "年份，yyyy"),
            @ApiImplicitParam(name = "name", value = "地区名称中文"),
            @ApiImplicitParam(name = "areaType", value = "地区类型，1.国家 2省域3.城市"),
            @ApiImplicitParam(name = "languageType", value = "语言类型 en:英文，cn中文，默认中文")
    })
    public ReturnVO cityDetail(@RequestParam("type") String type,@RequestParam("year") String year,@RequestParam("name") String name,@RequestParam(value = "languageType",defaultValue = "cn")String languageType,@RequestParam(value = "areaType",required = false)String areaType){
        return zsIndexDetailService.innerCountryDetail(type,languageType,name,year,areaType);
    }

    @ApiOperation(value="数据比较--初始化展示接口", notes = "数据比较--初始化展示接口")
    @GetMapping(value = "/dataCompareInit")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type", value = "类型，1:全球数字竞争力指数，2.大数据发展指数,3.大数据法治指数,4.大数据安全指数,5.大数据金融风险防控指数,6.治理科技指数"),
            @ApiImplicitParam(name = "year", value = "年份，yyyy"),
            @ApiImplicitParam(name = "areaType", value = "地区类型，1.国家 2省域3.城市"),
            @ApiImplicitParam(name = "languageType", value = "语言类型 en:英文，cn中文，默认中文")

    })
    public ReturnVO dataCompareInit(@RequestParam("type") String type,@RequestParam("year") String year,@RequestParam(value = "areaType",required = false)String areaType,@RequestParam(value = "languageType",defaultValue = "cn")String languageType){

       // return zsIndexDetailService.list(type,year,areaType,languageType);
        return zsIndexDetailService.dataCompareInit(type,languageType,year,areaType);
    }


}
